<?php


namespace App\Http\Controllers\user;


use App\Dao\CommonDao;
use App\Dao\OrdersDao;
use App\Http\Controller;
use App\Services\Code;

/**
 * Class BaseController
 * @package App\Http\Controllers\admin
 * author:admin
 * desc:公共控制器
 * created_at: {2020/10/16}----10:38 上午
 */
class BaseController extends Controller
{

    public function settings(): array
    {
        return Code::message('',200,[
            'version'=>'1.0.3'
        ]);
    }

    public function test(){
        $orders = OrdersDao::builder_query()->whereNull('json_data')->get();
        foreach ($orders as $value){
            $goodsItem = '';
            $goods = CommonDao::goods();
            foreach ($goods as $valueItem){
                if($value['u_price'] == $valueItem['u_price']){
                    $goodsItem = $valueItem;
                }
            }
            OrdersDao::builder_query(['u_order_id'=>$value['u_order_id']])->update([
                'json_data'=>json_encode($goodsItem,JSON_UNESCAPED_UNICODE)
            ]);
        }
    }

}
